/*PROGRAM
		ARP000 - HWCS ACCOUNTS RECEIVABLE MAIN MENU
  PROGRAMMER
		ROBERT M. WHITE
  DATE WRITTEN
		APRIL 15, 1981
  PURPOSE
		THIS ROUTINE DISPLAYS THE MAIN MENU FOR THE
		ACCOUNTS RECEIVABLE SYSTEM AND ALLOWS THE
		OPERATOR TO SELECT THE APPROPRIATE FUNCTION
		TO BE PERFORMED WITHIN THE SYSTEM.
  INPUT
  OUTPUT
  REMARKS
*/

ARP000: PROC OPTIONS(MAIN);
/* * * *   A/R MASTER MENU PROGRAM  * * * */

/* * *  PROGRAM REPLACEMENTS * * */
%INCLUDE 'C:BTCCS.PLI';		/* BT-80 FUNCTIONS */
%INCLUDE 'C:BTERRCS.PLI';	/* BT-80 ERROR RETURN CODES */
%REPLACE FALSE BY '0'B;
%REPLACE TRUE BY '1'B;

/* * *  PROGRAM AREAS  * * */
	DCL	I BIN(7);    /* INDEX VARIABLE */
	DCL	RP CHAR(2);  /* CHAR RESPONSE */
	DCL	NRP BIN(15);  /* NUMERIC RESPONSE */
	DCL	RTN_COD BIN(7); /* SUBROUTINE RETURN CODE */

/* * *  COMMON DCL INCLUDES  * * */
%INCLUDE 'C:SUBS1.DCL';
%INCLUDE 'ARCOMMON.DCL';
%INCLUDE 'ARCUSTM.DCL';

/* * *  COMMON PROC INCLUDES * * */
	DCL	BTREE ENTRY(BIN(7),BIN(7),PTR,BIN(7));
	DCL	ARM000 ENTRY;	/* EXTERNAL MAPS */
	DCL	ARP010 ENTRY;	/* EXTERNAL PROGRAMS */
	DCL	ARP020 ENTRY;
	DCL	ARP030 ENTRY;
	DCL	ARP040 ENTRY;
	DCL	ARP050 ENTRY;
	DCL	ARP060 ENTRY;
	DCL	ARP070 ENTRY;

/* * *  START OF MAIN PROGRAM  * * */
PGM_BGN:
/* FORMAT BT-80 CONTROL BLOCKS (IOCB & OPENCB). */
	OPENCB1.IDXDRIVE='C';		/*FORMAT OPENCB.*/
	OPENCB1.IDXFILE='ARCUSTM';
	OPENCB1.IDXTYPE='DAT';
	OPENCB1.NPAGES=16;
	CALL CLRSCRN;
	CALL PUTMSG(1,1,'ENTER PASSWORD: ');
	CALL GETSTR(1,17,4,ADDR(OPENCB1.PW),RTN_COD);
	OPENCB1.DLYUPD=FALSE;
	OPENCB1.DRIVES(1)='C';
	OPENCB1.DRIVES(2)='C';
	IDX1=0;
	CALL BTREE(BT_OPEN,IDX1,ADDR(OPENCB1),RTN_COD);
	IF RTN_COD~=0 THEN
	   DO;
	      CALL PUTERR('OPEN RETURN CODE ='||RTN_COD||'.');
	      STOP;
	   END;
	IOCB1P=ADDR(IOCB1);		/*FORMAT IOCB.*/
	IOCB1.KEYPTR1=ADDR(REC1.CSID);
	IOCB1.RECPTR1=ADDR(REC1);
	CALL PUTMSG(2,1,'ENTER DATE(MMDDYY): ');
	CALL GETSTR(2,21,8,ADDR(CURDAT),RTN_COD);

/* HANDLE ALL MAJOR FUNCTIONS. */
MAIN_MENU:
	BEGIN;
	CALL ARM000;	/* PUT UP MASTER SCREEN. */
	CALL GETB15(12,23,NRP,0,07,RTN_COD);
	GOTO MAIN_FUNC(NRP);	/* PERFORM THE FUNCTION. */
	END; /* MAIN_MENU */

MAIN_FUNC(00): BEGIN;
	CALL CLRSCRN;
	CALL BTREE(BT_CLOSE,IDX1,ADDR(OPENCB1),RTN_COD);
	IF RTN_COD~=0 THEN
	   DO;
	      CALL PUTERR('CLOSE RETURN CODE ='||RTN_COD||'.');
	      STOP;
	   END;
	STOP;
	END;

MAIN_FUNC(01): BEGIN;
	CALL ARP010;
	GOTO MAIN_MENU;
	END;

MAIN_FUNC(02): BEGIN;
	CALL ARP020;
	GOTO MAIN_MENU;
	END;

MAIN_FUNC(03): BEGIN;
	CALL ARP030;
	GOTO MAIN_MENU;
	END;

MAIN_FUNC(04): BEGIN;
	CALL ARP040;
	GOTO MAIN_MENU;
	END;

MAIN_FUNC(05): BEGIN;
	CALL ARP050;
	GOTO MAIN_MENU;
	END;

MAIN_FUNC(06): BEGIN;
	CALL ARP060;
	GOTO MAIN_MENU;
	END;

MAIN_FUNC(07): BEGIN;
	CALL ARP070;
	GOTO MAIN_MENU;
	END;

	END ARP000;
